package org.igeek.atomqq.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

/** 
 * 类说明 
 * @author <a href="http://hangxin1940.cnblogs.com">hangxin1940@gmail.com</a>
 * @time 2012-2-1 下午03:53:58 
 */
public class AtomDBOpenHelper extends SQLiteOpenHelper {
	
	private final static String DATABASE_NAME= "atomqq_db"; 
	private final static int DATABASE_VERSION = 1; 
	
	private final static String CREATE_TABLE_FRD="CREATE TABLE [friend] ("
			+"[_id] INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT,"
			+"[category] INTEGER  NOT NULL,"
			+"[uin] VARCHAR(32)  UNIQUE NOT NULL,"
			+"[nick] VARCHAR(128)  NULL,"
			+"[lnick] VARCHAR(512)  NULL"
			+"[markname] VARCHAR(128)  NULL,"
			+"[birthday] VARCHAR(32)  NULL,"
			+"[phone] VARCHAR(32)  NULL,"
			+"[allow] INTEGER  NULL,"
			+"[constel] INTEGER  NULL,"
			+"[college] VARCHAR(32)  NULL,"
			+"[blood] INTEGER  NULL,"
			+"[homepage] VARCHAR(128)  NULL,"
			+"[stat] INTEGER  NULL,"
			+"[vip_info] INTEGER  NULL,"
			+"[country] VARCHAR(64)  NULL,"
			+"[city] VARCHAR(64)  NULL,"
			+"[personal] VARCHAR(768)  NULL,"
			+"[vip] INTEGER  NULL,"
			+"[vip_level] INTEGER  NULL,"
			+");";
	
	
	
	private final static String CREATE_TABLE_FRDCAT="CREATE TABLE [friend_category] ("
			+"[_id] INTEGER  PRIMARY KEY AUTOINCREMENT NOT NULL,"
			+"[index] INTEGER  UNIQUE NOT NULL,"
			+"[name] VARCHAR(32)  UNIQUE NULL"
			+");";
	
	
	private final static String CREATE_TABLE_GRP="CREATE TABLE [group] ("
			+"[_id] INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT,"
			+"[category] INTEGER  NULL,"
			+"[flag] INTEGER  NULL,"
			+"[gid] VARCHAR(32)  NULL,"
			+"[code] VARCHAR(32)  NULL,"
			+"[memo] VARCHAR(512)  NULL,"
			+"[fingermemo] VARCHAR(512)  NULL,"
			+"[owner] VARCHAR(32)  NULL,"
			+"[createtime] INTEGER  NULL,"
			+"[level] INTEGER  NULL,"
			+"[option] INTEGER  NULL"
			+");";
	
	
	private final static String CREATE_TABLE_GRPCAT="CREATE TABLE [group_category] ("
			+"[_id] INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT,"
			+"[name] VARCHAR(32)  NULL"
			+");";
	
	
	private final static String CREATE_TABLE_GRPMEM="CREATE TABLE [group_member] ("
			+"[_id] INTEGER  PRIMARY KEY AUTOINCREMENT NOT NULL,"
			+"[group] INTEGER  NOT NULL,"
			+"[uin] VARCHAR(32)  NULL,"
			+"[nick] VARCHAR(128)  NULL"
			+");";
	
	
	private final static String CREATE_TABLE_USR="CREATE TABLE [user] ("
			+"[_id] INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT,"
			+"[uin] VARCHAR(32)  UNIQUE NOT NULL,"
			+"[passwd] VARCHAR(128)  NULL,"
			+"[sound] INTEGER DEFAULT '1' NULL,"
			+"[shock] INTEGER DEFAULT '0' NULL,"
			+"[status] VARCHAR(32) DEFAULT 'online' NULL"
			+");";
	
	

	public AtomDBOpenHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		/*db.execSQL(CREATE_TABLE_FRD);
		db.execSQL(CREATE_TABLE_FRDCAT);
		db.execSQL(CREATE_TABLE_GRP);
		db.execSQL(CREATE_TABLE_GRPCAT);
		db.execSQL(CREATE_TABLE_GRPMEM);
		db.execSQL(CREATE_TABLE_USR);*/
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

	}

}
